Public Class HorariosGrid
    
    Private Sub LlenarForm1()
        HorarioForm.TextBox1.Text = DataGridView1.CurrentRow.Cells(0).Value.ToString
        HorarioForm.ComboBox1.SelectedItem = DataGridView1.CurrentRow.Cells(1).Value
        HorarioForm.ComboBox1.SelectedItem = DataGridView1.CurrentRow.Cells(2).Value
        HorarioForm.ComboBox2.SelectedItem = DataGridView1.CurrentRow.Cells(3).Value
        HorarioForm.ComboBox3.SelectedItem = DataGridView1.CurrentRow.Cells(4).Value
    End Sub

    Private Sub mnuAgregar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuAgregar.Click
        HorarioForm.operacion = "Alta"

        HorarioForm.Show()

    End Sub

    Private Sub mnuEditar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuEditar.Click
        HorarioForm.operacion = "Modifica"
        HorarioForm.indice = DataGridView1.CurrentRow.Index

        LlenarForm1()

        HorarioForm.Show()

    End Sub

    Private Sub mnuEliminar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuEliminar.Click
        HorarioForm.operacion = "Elimina"
        HorarioForm.indice = DataGridView1.CurrentRow.Index

        LlenarForm1()

        HorarioForm.Show()

    End Sub

    Private Sub mnuSalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuSalir.Click
        Me.Close()
    End Sub

    Private Sub HorariosGrid_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        horarios_list.TraerHorarios()
        DataGridView1.DataSource = horarios_list
    End Sub

    Private Sub mnuActualizar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuActualizar.Click
        horarios_list.TraerHorarios()
    End Sub
End Class
